/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 purang All Rights Reserved
// Name:        rw_lock_win.h
// Purpose:
// Author:      syy
// Modified by:
// Created:     2014/1/3 15:41
// RCS-ID:
// Licence:
/////////////////////////////////////////////////////////////////////////////

#ifndef PR_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_
#define PR_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_

#include <Windows.h>

#include "rw_lock_wrapper.h"

namespace qb {

class RWLockWin : public RWLockWrapper {
 public:
  static RWLockWin* Create();
  ~RWLockWin() {}

  virtual void AcquireLockExclusive();
  virtual void ReleaseLockExclusive();

  virtual void AcquireLockShared();
  virtual void ReleaseLockShared();

 private:
  RWLockWin();
  static bool LoadModule();

  SRWLOCK lock_;
};

}  // namespace qb

#endif  // PR_SYSTEM_WRAPPERS_SOURCE_RW_LOCK_WIN_H_
